package com.hnjd.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.hnjd.entity.Goods;
import com.hnjd.entity.Tops;
import com.hnjd.util.PageUtil;

public interface TopsMapper {

	
	@Select("SELECT tops.*,goods.* FROM tops INNER JOIN goods ON tops.good_id=goods.id ")
	public List<Goods> findGoodsById();
	
	@Select("SELECT tops.*,goods.* FROM tops INNER JOIN goods ON tops.good_id=goods.id limit #{start},#{pageSize} ")
	public List<Goods> findGoods(PageUtil page);
	
	@Select("select * from tops")
	public List<Tops> findAllTops();

	 
	@Insert("insert into tops values(null,#{type},#{goodId})")
	public void topSave(Tops top);

	@Delete("delete from tops where good_id=#{goodId}")
	public void topDelete(Integer goodId);
	
}
